import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
import HomeView from '../views/HomeView.vue'

type CusRouteRecordRaw = RouteRecordRaw & {
  cmpName: string
}

const routes: CusRouteRecordRaw[] = [
  {
    cmpName: '主页',
    path: '/',
    name: 'HomeView',
    component: HomeView,
  },
  {
    cmpName: '关于',
    path: '/AboutView',
    name: 'AboutView',
    component: () => import('../views/AboutView.vue'),
  },
  {
    cmpName: '编辑器Json',
    path: '/EditorViewJson',
    name: 'EditorViewJson',
    component: () => import('../views/EditorViewJson.vue'),
  },
  {
    cmpName: '编辑器Js',
    path: '/EditorViewJs',
    name: 'EditorViewJs',
    component: () => import('../views/EditorViewJs.vue'),
  },
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: routes,
})

export default router

export { routes }
